<template>
	<view>
		<view class="menus">
			<img :src="avatar || '../../static/image/bg_img.png'" alt="">
			<view>
				<view class="bigs">{{nickname}}</view>
<!-- 				<view class="grays grays1">{{bio}}</view> -->
			</view>
			<img src="../../static/image/forword.png" alt="">
		</view>
		<image v-if="is_user == 2" class="imgs" src="../../static/image/jiaruqun.png" @click="jiaru"></image>
		<image v-if="is_user == 1" class="imgs" src="../../static/image/faxiaoxi_29.png" @click="xiaoxi"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickname:'',
				avatar:'',
				search:'',
				is_user:'',
				groupnum: '', //群号
				id:''
			}
		},
		onShow() {
			this.$msgchat.initwork();
		},
		async onLoad(options) {
			this.search = options.search;
			this.groupnum = options.groupnum;
			this.initDat();
		},
		methods: {
			//初始数据
			initDat(){
				this.$common.requests('/api/group/findqun',{search: this.groupnum}).then(res => {
					if(res.data.code == 1){
						this.nickname = res.data.data.name;
						this.is_user = res.data.data.is_user;
						this.id = res.data.data.id;
						if(res.data.data.avatar != ''){
							this.avatar = this.$common.baseUrl + res.data.data.avatar;
						}
						if(res.data.msg == '已添加'){
							this.is_friend = 1;
						}else{
							this.is_friend = 2;
						}
					}
				})
			},
			//申请
			jiaru(){
				var obj = {
					qid : this.id
				}
				this.$common.requests('/api/group/saomajinqun', obj).then(res => {
					this.$api.msg(res.data.msg);
				})
			}
		}
	}
</script>

<style>
.menus{
	width: 92%;
	margin: 0 auto;
	border-bottom: solid 2upx #EEEEEE;
	padding: 20upx 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.menus>img:nth-child(1){
	width: 90upx;
	height: 90upx;
	border-radius: 10upx;
}
.menus>view:nth-child(2){
	width: 75%;
}
.menus>img:nth-child(3){
	width: 30upx;
	height: 30upx;
}
.bigs{
	font-size: 32upx;
}
.grays{
	color: #B6B5B5;
	font-size: 26upx;
}
.grays1{
	padding-top: 15upx;
}
.imgs{
	position: fixed;
	bottom: 20%;
	width: 90%;
	left: 5%;
	display: flex;
	justify-content: space-between;
	height: 80upx;
}

</style>
